﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common.UI.EM.Views;
using SEG.ServiceLogic;
using SEG.Model;
using Common.UI.EM.Views.Interfaces;
using Common.Security;

namespace SEG.UI.Control.Presenters
{
    public class AdministrarUsuariosEntityPresentationModel : EntityPresentationModel<AdministrarUsuariosServiceLogic, Usuario, AdministrarUsuariosCriteria, AdministrarUsuariosView>
    {

        public AdministrarUsuariosEntityPresentationModel(IFilterView filterView, IListView listView, IDetailView detailView)
            : base(filterView, listView, detailView)
        {
        }

        protected override void BeforeSave()
        {
            if (this.EntityObject.Contrasenia != this.EntityObject.ContraseniaOriginal)
            {
                //contraseña cambio
                this.EntityObject.Contrasenia = Cryptography.GetPassword(this.EntityObject.Contrasenia);
            }
        }
    }
}
